# coding:utf-8

iter_obj = iter((1, 2, 3))


def _next(iter_obj):
    try:
        return next(iter_obj)
    except StopIteration:
        return None


# print(_next(iter_obj))
# print(_next(iter_obj))
# print(_next(iter_obj))
# print(_next(iter_obj))

def make_iter():
    for i in range(10):
        yield i


iter_obj2 = make_iter()
print(type(iter_obj2))  # <class 'generator'>

for i in iter_obj2:
    print(i)
print('------')
for i in iter_obj2:
    print(i)

iter_obj3 = (i for i in range(10))

for i in iter_obj3:
    print(i)
print('======')
for i in iter_obj3:
    print(i)
